import axios from 'axios'

// axios.interceptors.request.use(function (config) {
//   let mytoken = localStorage.getItem('mytoken')
//   if (mytoken) {
//     config.headers.Authorization = mytoken
//   }
//   return config
// }, function (error) {
//   return Promise.reject(error)
// })
axios.defaults.baseURL = 'http://localhost:8888/api'

// 获取新闻列表
export const getNewsList = () => axios.get('/getnewslist')

// 获取新闻详情列表
export const getNewsDetail = id => axios.get(`/getnew/${id}`)

// 获取评论列表
export const getComment = (id, pageindex) => axios.get(`/getcomments/${id}`, { params: { pageindex } })

// 发表评论列表
export const publishComment = (id, obj) => axios.post(`/postcomment/${id}`, obj)

// 获取图片top列表
export const getImagesList = () => axios.get(`/getimgcategory`)

// 获取图片内容列表
export const getImgList = (id) => axios.get(`/getimages/${id}`)

// 获取图文详情
export const getImgParticulars = (id) => axios.get(`/getthumimages/${id}`)

// 获取缩略图描述
export const getImgDescribe = (id) => axios.get(`/getimageInfo/${id}`)

// 获取商品列表
export const getDity = (pageindex) => axios.get(`/getgoods`, { params: { pageindex } })

// 获取商品详情

export const getDityDetail = (id) => axios.get(`/goods/getinfo/${id}`)

// 获取商品图文详情
export const getDityImgDetail = (id) => axios.get(`/goods/getdesc/${id}`)

// 获取轮播图资源
export const getWeper = (id) => axios.get(`/getthumimages/${id}`)
